﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace IWMAG.Scripting.Tests.Compiler
{
    public class TestTextWriter : TextWriter
    {

        private StringBuilder _getText = new StringBuilder();
        public string GetText
        {
            get
            {
                return _getText.ToString();
            }
        }

        public override void Write(string value)
        {
            WriteImpl(value);
        }

        private void WriteImpl(string value)
        {
            _getText.Append(value);
        }

        public override void Write(char value)
        {

            WriteImpl(value.ToString());
        }

        public override void WriteLine(string value)
        {

            WriteImpl(value + Environment.NewLine);
        }

        public override Encoding Encoding
        {
            get { return Encoding.Default; }
        }

    }
}
